import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;

public class LInklsit {
    public static void main(String[] args) {
        LinkedList<String> list = new LinkedList<>();
        //添加元素
        list.add("stuent1");
        list.add("stuent2");
        System.out.println(list);
        list.offer("offer");
        list.push("pish");
        System.out.println(list);
//        获取元素
        Object object =list.peek();
        System.out.println(object);
//        删除元素po
        list.removeFirst();
        list.pollLast();
        System.out.println(list);
        ArrayList<String> li = new ArrayList<>();
        li.add("stuent1");
        li.add("stuent2");
        Iterator it = li.iterator();
        while(it.hasNext()){
            System.out.println(it.next());
        }
    }
}
